/***************************************************************************
 * engine.cpp
 * Copyright (C) 2010  Jared Bell
 *
 * This file is part of FreeESP.
 *
 * FreeESP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * FreeESP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with FreeESP.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Credits:
 * + compudaze <compudaze@gmail.com> - FreeESP author.
 * + SuperNovaAO <itshax.com> - posted his CoD6Wallhack180 source code &
 *   showed me how to access the console.
 * + R3B3L <gamedeception.net forums> - posted how to disable recoil.
 ***************************************************************************/

#include "engine.h"

void SetMinimumPlayers() {
  SendCommandToConsole("seta party_minplayers 1");
}

void ForceHostEnable() {
  SendCommandToConsole("seta party_hostmigration 0");
  SendCommandToConsole("seta party_connecttimeout 1");
  SendCommandToConsole("seta badhost_endGameIfISuck 0");
}

void ForceHostDisable() {
  SendCommandToConsole("seta party_hostmigration 1");
  SendCommandToConsole("seta party_connecttimeout 0");
  SendCommandToConsole("seta badhost_endGameIfISuck 1");
}

void ShowFpsToggle() {
  SendCommandToConsole("toggle cg_drawfps");
}

/* need to unlock cheat/write protected stuff */
void SendCommandToConsole(CHAR* command) {
  _asm {
    push	command
    push	1
    push	1
    call	consoleFunction
  }

  /* old way
  _asm {
    push  command
    push  0
    call  dwSend
    add   esp, 0x8
  }
  */
}